<template>
  <div>
    生成二维码
    <!-- qrcode
           1:下载  yarn add qrcode
           2:导入  import Qrcode from 'qrcode'
           3: canvas  ref="canvas"
           4:Qrcode.toCanvas(展示二维码的dom,需要转换成二维码的字符,{width:500})

     -->
    <canvas ref="canvas" />
    <el-button @click="btnClick">生成二维码</el-button>
  </div>
</template>
<script>
import Qrcode from 'qrcode'
export default {
  methods: {
    btnClick() {
      Qrcode.toCanvas(this.$refs.canvas, 'http://www.baidu.com', {
        width: 500
      })
    }
  }
}
</script>
<style></style>
